﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyNganHangDe.GUI.HeThong
{
    public partial class FormTaoFileSQL : Form
    {
        public FormTaoFileSQL()
        {
            InitializeComponent();
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog op = new OpenFileDialog();
            op.Filter = "(*.sql)|*.sql";
            if (op.ShowDialog() == DialogResult.OK)
            {
                txtPath.Text = op.FileName;
            }
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtPath.Text))
                MessageBox.Show("Bạn chưa chọn file .SQL", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            else
            {
                FormThietLapChuoiKetNoi.WriteFileBinary(File.ReadAllText(txtPath.Text), System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath)
              + "\\db.bin");
                MessageBox.Show("Mã hóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
    }
}
